import allure
from page_object.page_roncoo_addrole import AddRole
from page_element.el_Roncoo import *
from utils.timer import sleep
import logging

class Addoprator(AddRole):
    def add_oprator(self,rolename,rolecode,roledesc,opratorname,opratoremail,opratorpwd,opratormobile,opratordesc):
        self.addrole(rolename=rolename,rolecode=rolecode,roledesc=roledesc)
        with allure.step(f'点击操作员管理'):
            self.click(Operator.operator_a)
        with allure.step(f'点击添加操作员'):
            self.click(Operator.add_operator)
        with allure.step(f'输入操作员姓名：{opratorname}'):
            self.send_keys(Operator.operator_name,opratorname)
        with allure.step(f'输入操作员登录名：{opratoremail}'):
            self.send_keys(Operator.oprator_email,opratoremail)
        with allure.step(f'输入密码：{opratorpwd}'):
            self.send_keys(Operator.oprator_pwd,opratorpwd)
        with allure.step(f'输入手机号：{opratormobile}'):
            self.send_keys(Operator.oprator_mobile,opratormobile)
        sleep(7)
        with allure.step('滚到底部'):
            self.scroll_to_bottom()
        sleep(3)
        with allure.step(f'输入描述：{opratordesc}'):
            self.send_keys(Operator.oprator_desc,opratordesc)
        with allure.step('选择角色'):
            self.click(Operator.chioce_role)
        with allure.step('点击保存'):
            self.click(Operator.oprator_submit)
        #查看
        with allure.step('查看操作员详情'):
            self.click(Operator.oprator_mess)